const expressJWT = require("express-jwt")
const jwtAuth = expressJWT({
    secret:"miyao", //用相同的密钥来讲token解析出来
    algorithms:["HS256"], //设置JWT的加密算法
    credentialsRequired:true 
    // false:对于没有token的请求就不进行校验
    // true：不管有没有token都要进行校验，没有token直接失败
}).unless({
    // 配置不需要校验的地址。配置白名单
    path:["/user/login","/user/register","/user/uploadImages","/collection"]
    // path:["/user/login","/user/register","/user/getU","/user/userA","/user/uploadImages","/user/geturl","/user/z"]
})
module.exports = jwtAuth